import httpServe from '@/global-services/index';
type _tsObj = Record<string, any>;

// 报警中心
export const AlarmCenterAPI = {
	list: (data: _tsObj) => httpServe.getTableHttp('/base/mAlgorithmAlarm/page')(data), // 算法报警列表数据
	AIServiceList: () => httpServe.getHttp('/base/aiService/selectList')(), // AI服务数据
	boxDeviceList: () => httpServe.getHttp('/base/mDevice/boxDeviceCascade')(), // 盒子/摄像头数据
	getById: (id: number | string) => httpServe.getHttp(`/base/mAlgorithmAlarm/getById/${id}`), // 根据ID单个查询
	getDeviceList: () => httpServe.getHttp('/base/mirgic/box/monitor/getDeviceList')(), // 获取设备列表
	// downloadImage: (data: any) => httpServe.getHttp(`/alarmCenter/mAlgorithmAlarm/downloadImage`)(data) // 图片下载

	downloadAndExport: (data: any) => httpServe.downloadAlarmImgs('/base/mAlgorithmAlarm/downloadImage')(data, { responseType: 'blob' }), // 图片下载

	hardWareList: (data: _tsObj) => httpServe.getTableHttp('/base/mHardwareAlarm/page')(data), // 硬件报警列表数据
	getType: () => httpServe.getHttp('/base/mHardwareAlarms/type')(), // 获取设备列表
	getBox: () => httpServe.getHttp('/base/box/selectList')(),
	exportHardWare: (data: any) =>
		httpServe.downloadAlarmImgs(`/base/mHardwareAlarms/export?idList=${data}`)({}, { responseType: 'arraybuffer' }), // 硬件导出

	// 根据开关标识查询开关状态
	switchConfig: (data: string | number) => httpServe.getHttp(`/base/switchConfig/getByTag/${data}`)(),
	//根据ID修改开关标识状态
	updateSwitchConfigStatus: (data: any) => httpServe.putHttp('/base/switchConfig/updateStatus')(data),
	// 根据ID修改审批状态
	updateAuditStatus: (data: any) => httpServe.putHttp('/base/mAlgorithmAlarm/updateAuditStatus')(data)
};
